<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>log in</title>
    <script src="/jquery-3.2.1.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("button[name='log']").click(function () {
                var user = $("#user").val();
                var password = $("#password").val();
                console.log(user);
                var url = "/demo/logB";
                var data = {"user":user,"password":password};
                $.post(
                    url,
                    data,
                    function (map) {
                       console.log(map.user);
                       console.log(map.password);
                      $("div p:eq(0)").html(map.user);
                      $("div p:last").html(map.password);
                      $("div").show();
                      var user = map.user;
                      var password = map.password;
                      if(map.user == "abc"){
                          console.log(user);
                          location.href=" /demo/logD?user="+user+"&password="+password+ "";
                      }
                    }
                );
//                $.post(
//                    url,
//                    data,
//                    function (message) {
//                        alert(message);
//                    }
//                );
            });
        });
    </script>
</head>
<body>
    账号：<input type="text" id="user"><br>
    密码：<input type="text" id="password"><br>
    <button type="button" name="log" >登陆</button>

    <div id="div1" style="display: none">
        你输入的密码是:<p> </p>
        您输入的账号是:<p> </p>
    </div>

</body>
</html>